<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>一条语句，多个变量</title>
</head>

<body>
    <script>
        //您可以在一条语句中声明很多变量。该语句以 var 开头，并使用逗号分隔变量即可：
        var lastname = "Doe", age = 30, job = "carpenter";
        //声明也可横跨多行：
        var lastname1 = "Doe",
            age1 = 30,
            job1 = "carpenter";
        //一条语句中声明的多个变量不可以同时赋同一个值:
        var x, y, z = 1;
        console.log(x + " " + y + " " + z); //undefined undefined 1
        //x,y 为 undefined， z 为 1。
    </script>
</body>

</html>